#ifndef LEVEL_H_INCLUDED
#define LEVEL_H_INCLUDED
#include <iostream>
#include <sstream>
#include <SFML\System.hpp>
#include <SFML\Window.hpp>
#include <SFML\Graphics.hpp>

class ImgMgr;
class RessourceMgr;
class Tile;
class Unit;
class Struct;
class RessourceStruct;
class GrassTile;
class WaterTile;
class SandTile;
class DirtTile;
class ForumStruct;
class FarmStruct;
class TreeStruct;

class Level
{
public:
	Level();
	~Level();
	void init(ImgMgr *imageManager);
	void maj(RessourceMgr *ressourceMgr);
	void render(sf::RenderWindow *app, sf::View *view);
	int getTile(const sf::Vector2f position, const int u) const;
	void setTile(Tile *tile, const sf::Vector2f position, const int u);
	void loadLevel(const std::string chemin);
	void addUnit(Unit *unit, sf::Vector2f position, const int idTeam);
	bool addStruct(Struct *structure, sf::Vector2f position, const int idTeam);
	bool addRessourceStruct(RessourceStruct *ressourceStruct, sf::Vector2f position);
	bool collisionTile(const sf::Vector2f position, const int direction);
	int random(int a, int b);
	void tri();
	std::vector<Unit*>* getUnit();
	std::vector<Struct*>* getStruct();
	std::vector<RessourceStruct*>* getRessourceStruct(); 
	int m_width;
	int m_height;

private:
	ImgMgr *m_imageManager;
	Tile *m_tile[2][128][128];
	std::vector<Unit*> m_unit;
	std::vector<Struct*> m_struct;
	std::vector<RessourceStruct*> m_ressourceStruct;

};

#endif
